/*
 * @Description 
 * @Autor lzhiqiang
 * @Date 2023-02-25 13:26:11
 * @LastEditors lzhiqiang
 * @LastEditTime 2023-03-06 16:08:17
 */
#include "johnsonli.h"




void test_schedule()
{

}

void schedule1()
{
	LOG_INFO(LOG_ROOT()) << "schedule1";
	//sleep(1);
	
	// sleep(1);
	static int count = 5;
	sleep(1);
	while(--count >=0)
	{
		johnsonli::Scheduler::GetThis()->schedule(schedule1);
	}
	
}

void schedule2()
{
	LOG_INFO(LOG_ROOT()) << "schedule2";
}

void schedule3()
{
	LOG_INFO(LOG_ROOT()) << "schedule3";
}


int main()
{
	johnsonli::Thread::SetName("MAIN");

	YAML::Node root = YAML::Load("/home/ubuntu/project/c++/ServerFramework/config/logs.yaml");
	johnsonli::Config::LoadFromYaml(root);

	johnsonli::Fiber::ptr fiber1(new johnsonli::Fiber(schedule1));

	johnsonli::Scheduler sc(1, false, "name");

	sc.start();
	sc.schedule(fiber1);
	sc.stop();

	LOG_INFO(LOG_ROOT()) << "over";


	return 0;
}